<script src="../resources/js-test.js"></script>

<style>
#paragraph {
    width: 10em;
}
#paragraph:before {
    content: '   One two three\A four   five ';
}
#paragraph:after {
    content: '   eleven twelve  thirteen ';
}
</style>

<p id="paragraph">
    six seven
    eight  nine ten
</p>

<script>

    description('Tests that whitespace is properly collapsed in CSS generate content, and that the concatenation of all of the strings from inline text boxes matches the string value of the text object.');

    if (window.accessibilityController) {
        var axParagraph = accessibilityController.accessibleElementById('paragraph');
        for (var i = 0; i < axParagraph.childrenCount; i++) {
            var axStaticText = axParagraph.childAtIndex(i);
            var text = axStaticText.stringValue.substr(9);

            var concatenatedInlineText = '';
            for (var j = 0; j < axStaticText.childrenCount; j++) {
                var axInlineTextBox = axStaticText.childAtIndex(j);
                var inlineText = axInlineTextBox.stringValue.substr(9);
                concatenatedInlineText += inlineText;
            }

            shouldBe('text', 'concatenatedInlineText');
        }
    }
</script>

